package com.jumptap.adtag.actions;

import android.net.Uri;
import android.util.Log;

public class ActionFactory
{
  private static AdAction browserAction = new BrowserAdAction();
  private static AdAction callAction = new CallAdAction();
  private static AdAction mapAdAction = new MapAdAction();
  private static AdAction storeAdAction = new StoreAdAction();
  private static AdAction videoAdAction = new VideoAdAction();
  private static AdAction youTubeAdAction = new YouTubeAdAction();

  public static AdAction createAction(String paramString1, String paramString2)
  {
    Log.d("JtAd", "createAction from url:" + paramString1);
    String str1 = AdAction.getRedirectedUrl(paramString1, paramString2);
    Log.d("JtAd", "redirected Url:" + str1);
    AdAction localAdAction;
    if ((str1 != null) && (!"".equals(str1)))
      localAdAction = createActionByUri(Uri.parse(str1));
    while (true)
    {
      if (localAdAction == null)
      {
        String str2 = Uri.parse(paramString1).getQueryParameter("t");
        Log.d("JtAd", "actionType= " + str2);
        localAdAction = createActionByType(str2);
      }
      if (localAdAction == null)
        localAdAction = browserAction;
      localAdAction.setUrl(paramString1);
      localAdAction.setRedirectedUrl(str1);
      localAdAction.setUserAgent(paramString2);
      return localAdAction;
      localAdAction = browserAction;
      str1 = paramString1;
    }
  }

  private static AdAction createActionByType(String paramString)
  {
    AdAction localAdAction;
    if ((paramString == null) || (paramString.equals("uri")) || (paramString.equals("url")))
      localAdAction = browserAction;
    boolean bool;
    do
    {
      return localAdAction;
      if ((paramString.equals("call")) || (paramString.equals("tel")))
        return callAction;
      if ((paramString.equals("video")) || (paramString.equals("movie")))
        return videoAdAction;
      if (paramString.equals("youtube"))
        return youTubeAdAction;
      if ((paramString.equals("map")) || (paramString.equals("gmap")))
        return mapAdAction;
      if (paramString.equals("itunes"))
        break;
      bool = paramString.equals("store");
      localAdAction = null;
    }
    while (!bool);
    return storeAdAction;
  }

  private static AdAction createActionByUri(Uri paramUri)
  {
    String str1 = paramUri.getScheme();
    String str2 = paramUri.getHost();
    String str3 = paramUri.getPath();
    Log.d("JtAd", "Creating action from scheme:" + str1 + "  host: " + str2 + "   path:" + str3);
    AdAction localAdAction;
    if ("about".equals(str1))
      localAdAction = browserAction;
    boolean bool2;
    do
    {
      do
      {
        boolean bool1;
        do
        {
          return localAdAction;
          if (("tel".equals(str1)) || ("sms".equals(str1)))
            return callAction;
          if ((str3 != null) && (!"".equals(str3)) && (isVideoExt(str3)))
            return videoAdAction;
          if ("maps.google.com".equals(str2))
            return mapAdAction;
          bool1 = "www.youtube.com".equals(str2);
          localAdAction = null;
        }
        while (!bool1);
        localAdAction = null;
      }
      while (str3 == null);
      bool2 = "/watch".contains(str3);
      localAdAction = null;
    }
    while (!bool2);
    return youTubeAdAction;
  }

  private static boolean isVideoExt(String paramString)
  {
    return (paramString.endsWith(".mov")) || (paramString.endsWith(".avi")) || (paramString.endsWith(".mpg")) || (paramString.endsWith(".mpeg")) || (paramString.endsWith(".wmv")) || (paramString.endsWith(".wma")) || (paramString.endsWith(".mp4")) || (paramString.endsWith(".3pg"));
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.jumptap.adtag.actions.ActionFactory
 * JD-Core Version:    0.6.2
 */